package br.com.gaacorp.sai.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

@Entity
@Table(name = "tab_question")
public class Question extends BaseObject implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -3215909345020902333L;
	private Long questionId;
	private String description;
	private Questionnaire questionnaire;

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (!(o instanceof Question)) {
			return false;
		}

		final Question question = (Question) o;

		return !(description != null ? !description
				.equals(question.description) : question.description != null);
	}

	public String getDescription() {
		return description;
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Long getQuestionId() {
		return questionId;
	}

	public Questionnaire getQuestionnaire() {
		return questionnaire;
	}

	public int hashCode() {
		return (description != null ? description.hashCode() : 0);
	}

	public void setDescription(String description) {
		this.description = description;
	}

	public void setQuestionId(Long questionId) {
		this.questionId = questionId;
	}

	public void setQuestionnaire(Questionnaire questionnaire) {
		this.questionnaire = questionnaire;
	}

	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.SIMPLE_STYLE).append(
				this.description).toString();
	}

}
